import service from '@/utils/request'

const url = {
  //获取联系人列表
  getContact: '/message/contact',
  //获取私信内容
  getContent: '/message/content',
  //发送私信
  sendMessage: '/message/send',
  //获取@过我的列表
  getAtList: '/message/at',
  //获取回复过我的列表
  getReplyList: '/message/reply',
  //获取系统消息列表
  getNoticeList: '/message/notice',
  //添加用户为联系人
  addContact: '/message/add',
  //获取用户昵称
  getName: '/message/name',
  // 已读
  read: '/message/read'
}

export const Message = {
  getContact: function (params) {
    return service({
      url: url.getContact,
      method: 'get',
      params
    })
  },
  getContent: function (params) {
    return service({
      url: url.getContent,
      method: 'get',
      params
    })
  },
  sendMessage: function (data) {
    return service({
      url: url.sendMessage,
      method: 'post',
      data
    })
  },
  getAtList: function (params) {
    return service({
      url: url.getAtList,
      method: 'get',
      params
    })
  },
  getReplyList: function (params) {
    return service({
      url: url.getReplyList,
      method: 'get',
      params
    })
  },
  getNoticeList: function (params) {
    return service({
      url: url.getNoticeList,
      method: 'get',
      params
    })
  },
  addContact: function (data) {
    return service({
      url: url.addContact,
      method: 'post',
      data
    })
  },
  getName: function (params) {
    return service({
      url: url.getName,
      method: 'get',
      params
    })
  },
  read: function (params) {
    return service({
      url: url.read,
      method: 'get',
      params
    })
  }
}
